package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenContractSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerContractAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.contract.Contract;
import com.wlyuan.open.scanner.repository.ContractRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.CONTRACT)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerContractHandler extends BaseScannerHandler<Contract, OpenContractSyncDTO> {
    private final ContractRepository contractRepository;

    @Override
    protected List<Contract> select() {
        return contractRepository.list();
    }

    @Override
    protected List<OpenContractSyncDTO> assembler(List<Contract> data) {
        return ScannerContractAssembler.assemble(data);
    }

}
